#coding:utf-8

from django.shortcuts import render
from django.shortcuts import HttpResponse,render_to_response
# Create your views here.

def home(request):
    # return HttpResponse("ok")
    dic={'name':'jinxl','age':'22'}
    return render(request,'home.html',dic)

def son(request):
    return render(request,'son1.html')

def login(request):
    # 如果是get请求
    # 如果是post，检验用户输入
    # print request.method
    if request.method == "POST":
        input_email = request.POST['email']
        input_pwd = request.POST['pwd']
        if input_email == 'jinxl@qq.com' and input_pwd == '123':
            from django.shortcuts import redirect
            return redirect("/son/")
        else:
            return render(request,'login.html',{'status':"用户名或密码错误",})
    return render(request,'login.html')